package com.example.administrator.testproject.MVP.ViewDraw;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.ViewGroup;

/**
 * Created by Administrator on 2016/10/25 0025.
 */

public class TestMainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new CView(this));
        Display display = getWindow().getWindowManager().getDefaultDisplay();
        DisplayMetrics displayMetrics = new DisplayMetrics();
        display.getMetrics(displayMetrics);
        Log.i("TAGSS", "DislayHeight = " + displayMetrics.heightPixels);
        Log.i("TAGSS", "DislayWidth = " + displayMetrics.widthPixels);
    }


    public class CView extends ViewGroup{

        public CView(Context context) {
            super(context);
        }

        public CView(Context context, AttributeSet attrs) {
            super(context, attrs);
        }

        @Override
        protected void onLayout(boolean b, int i, int i1, int i2, int i3) {
            Log.i("TAGSS", "b = " + b + " i = " + i + " i1 = " + i1 + " i2 = " + i2 + " i3 = "+ i3);
        }

        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
            Log.i("TAGSS", "widthMeasureSpec : " + widthMeasureSpec + "\n" + "heightMeasureSpec : " + heightMeasureSpec);
        }
    }
}
